import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NumberTwo {
    public static void main(String[] args) {
        ArrayList<Integer> arrayList=new ArrayList<>();
        arrayList.add(1);
        arrayList.add(1);
        arrayList.add(1);
        arrayList.add(1);
        arrayList.add(1);

        //自增for循环
        for (int i = 0; i < arrayList.size(); i++) {
            System.out.println(arrayList.get(i));
        }
        System.out.println("————————————————————————————————————");
        //迭代器遍历
        Iterator<Integer> iterator = arrayList.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("————————————————————————————————————");
        //增强for循环遍历
        for (Integer integer : arrayList) {
            System.out.println(integer);
        }

    }
}
